package com.demo.user;

import com.demo.common.model.User;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

public class UserChangePwdValidator extends Validator {

    @Override
    protected void validate(Controller controller) {
        validateRequiredString("user.pwd", "pwdMsg", "请输入密码!");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.keepModel(User.class);

        String actionKey = getActionKey();
        if (actionKey.equals("/user/changepwd"))
            controller.render("changepwd.html");
    }
}
